#include <pthread.h>
#include <stdio.h>

void  print_ids(const char* s) {
	pid_t pid = getpid();
	pthread_t tid = pthread_self();
	printf("%s pid=%u,tid=%u (0x%x)\n", s, pid, tid, tid);
}

void * thread_fn(void * arg) {
	print_ids("new thread:");
	return (void *) 0;
}

void main(void) {
	pthread_t tid;
	int err;
	err = pthread_create(&tid, NULL, thread_fn, NULL);
	if (err != 0) {
		printf("cannot create thread\n");
		exit(1);
	}
	print_ids("main thread:");
	sleep(3);
	exit(0);
}

// gcc create.c -pthread -w